home *** CD-ROM | disk | FTP | other *** search
/ One Click 11 / OneClick11.iso / Bancos de Dados / Conversao / Mysql2Excel / Setup.exe / Mysql2Excel.exe / Frame.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2003-06-23  |  5.1 KB  |  64 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.2)
  3.  
  4. from wxPython.wx import *
  5. from class_conecta import *
  6. from class_excel import *
  7.  
  8. def create(parent):
  9.     return Frame(parent)
  10.  
  11. (wxID_FRAME, wxID_FRAMEBTNSUBMIT, wxID_FRAMECPBD, wxID_FRAMECPSENHA, wxID_FRAMECPSERVIDOR, wxID_FRAMECPTABELA, wxID_FRAMECPUSUARIO, wxID_FRAMEPANEL1, wxID_FRAMESTATICTEXT1, wxID_FRAMESTATICTEXT2, wxID_FRAMESTATICTEXT3, wxID_FRAMESTATICTEXT4, wxID_FRAMESTATICTEXT5) = map((lambda _init_ctrls: wxNewId()), range(13))
  12.  
  13. class Frame(wxFrame):
  14.     
  15.     def _init_utils(self):
  16.         pass
  17.  
  18.     
  19.     def _init_ctrls(self, prnt):
  20.         wxFrame.__init__(self, id = wxID_FRAME, name = u'Frame', parent = prnt, pos = wxPoint(524, 314), size = wxSize(448, 247), style = wxDEFAULT_FRAME_STYLE, title = u'Mysql2Excel')
  21.         self._init_utils()
  22.         self.SetClientSize(wxSize(440, 217))
  23.         self.panel1 = wxPanel(id = wxID_FRAMEPANEL1, name = 'panel1', parent = self, pos = wxPoint(0, 0), size = wxSize(440, 217), style = wxTAB_TRAVERSAL)
  24.         self.cpServidor = wxTextCtrl(id = wxID_FRAMECPSERVIDOR, name = u'cpServidor', parent = self.panel1, pos = wxPoint(160, 8), size = wxSize(144, 21), style = 0, value = 'IP ou DNS')
  25.         self.cpUsuario = wxTextCtrl(id = wxID_FRAMECPUSUARIO, name = u'cpUsuario', parent = self.panel1, pos = wxPoint(160, 40), size = wxSize(144, 21), style = 0, value = 'usuario')
  26.         self.staticText1 = wxStaticText(id = wxID_FRAMESTATICTEXT1, label = u'Servidor', name = 'staticText1', parent = self.panel1, pos = wxPoint(112, 8), size = wxSize(39, 13), style = 0)
  27.         self.staticText2 = wxStaticText(id = wxID_FRAMESTATICTEXT2, label = u'Usu├írio', name = 'staticText2', parent = self.panel1, pos = wxPoint(112, 40), size = wxSize(40, 16), style = 0)
  28.         self.cpSenha = wxTextCtrl(id = wxID_FRAMECPSENHA, name = u'cpSenha', parent = self.panel1, pos = wxPoint(160, 72), size = wxSize(144, 21), style = wxTE_PASSWORD, value = 'senha')
  29.         self.staticText3 = wxStaticText(id = wxID_FRAMESTATICTEXT3, label = u'Senha', name = 'staticText3', parent = self.panel1, pos = wxPoint(112, 72), size = wxSize(31, 13), style = 0)
  30.         self.cpBD = wxTextCtrl(id = wxID_FRAMECPBD, name = u'cpBD', parent = self.panel1, pos = wxPoint(160, 104), size = wxSize(144, 21), style = 0, value = 'seu BD')
  31.         self.staticText4 = wxStaticText(id = wxID_FRAMESTATICTEXT4, label = u'Banco de dados', name = 'staticText4', parent = self.panel1, pos = wxPoint(72, 104), size = wxSize(78, 13), style = 0)
  32.         self.cpTabela = wxTextCtrl(id = wxID_FRAMECPTABELA, name = u'cpTabela', parent = self.panel1, pos = wxPoint(160, 136), size = wxSize(144, 21), style = 0, value = 'sua tabela')
  33.         self.staticText5 = wxStaticText(id = wxID_FRAMESTATICTEXT5, label = u'Tabela', name = 'staticText5', parent = self.panel1, pos = wxPoint(112, 136), size = wxSize(40, 16), style = 0)
  34.         self.btnSubmit = wxButton(id = wxID_FRAMEBTNSUBMIT, label = u'Criar Tabela do Excel', name = u'btnSubmit', parent = self.panel1, pos = wxPoint(168, 176), size = wxSize(112, 23), style = 0)
  35.         EVT_BUTTON(self.btnSubmit, wxID_FRAMEBTNSUBMIT, self.OnBtnsubmitButton)
  36.  
  37.     
  38.     def __init__(self, parent):
  39.         self._init_ctrls(parent)
  40.  
  41.     
  42.     def OnBtnsubmitButton(self, event):
  43.         excel = myExcel()
  44.         host = self.cpServidor.GetValue()
  45.         user = self.cpUsuario.GetValue()
  46.         senha = self.cpSenha.GetValue()
  47.         banco = self.cpBD.GetValue()
  48.         tabela = self.cpTabela.GetValue()
  49.         dados = conecta(host, user, senha, banco)
  50.         res = dados.query('select * from ' + tabela)
  51.         line = 0
  52.         for record in res:
  53.             col = 0
  54.             for field in res[line]:
  55.                 excel.setCell(1, line + 1, col + 1, res[line][col])
  56.                 col += 1
  57.             
  58.             line += 1
  59.         
  60.         excel.save(tabela)
  61.         excel.close()
  62.  
  63.  
  64.